<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" title="Default" href="main.css" type="text/css" />
</head>

<body>
<h2 align="center">Create A Guild</h2>
<hr/>

<?
$gname = $request->get("name", "");
$lname = $request->get("leader", "");

if($gname ne "" && $lname ne "") {
	$q="select id from character_ where name='".$EQDB->escape_string($lname)."'";
	my $res=$EQDB->query($q);
	if($res) {
		if(my $row=$res->fetch_row_hash) {
			my $lid = $row->{id};
			my $gid = $EQW->CreateGuild($gname, $lid);
			if($gid > 0 && $gid < 3000) {
				print "Guild $gname successfully created with ID $gid<br>";
			} else {
				print "Error creating guild. Check your logs.<br>";
			}
		} else {
			print "Unable to find '$lname'<br>";
		}
	} else {
		print "Unable to query leader's name.<br>";
	}
}

?>

<form method="POST" action="guildcreate.html">
Guild Name: <input name="name" type="text" value="<?print $gname;?>"><br>
Leader Char Name: <input name="leader" type="text" value="<?print $lname;?>"><br>
<input name="" type="submit" value="Create">
</form>

</body>
</html>
